using DanmakuGame;
using LitJson;
using UnityEngine;

public class LockStepWebsocket : ALiveWebSocketBase
{
    private static LockStepWebsocket _inst;
    public static LockStepWebsocket Instance
    {
        get
        {
            if (_inst == null)
                _inst = new LockStepWebsocket();

            return _inst;
        }
    }

    public LockStepWebsocket() : base(7373, true)
    {
    }

    protected override void OnReceivedBinary(byte[] buffer)
    {

    }

    protected override void OnReceivedString(string message)
    {
        if (message == null || message == string.Empty)
            return;

        var msg = JsonMapper.ToObject<NetFrameMsg>(message);
        LockStepMgr.Instance.NormalFrame(msg);
    }
}
